import React from 'react';
import IntentSection from './sections/IntentSection';
import StructSection from './sections/StructSection';
import RetrievalSection from './sections/RetrievalSection';
import ErrorSection from './sections/ErrorSection';

const StreamDataRenderer = ({ data, onItemHover, onItemLeave }) => {
    return data.map((item, index) => {
        switch (item.node) {
            case '意图识别':
                return (
                    <IntentSection
                        key={index}
                        data={item}
                    />
                );

            case '结构化提取':
                return (
                    <StructSection
                        key={index}
                        data={item}
                    />
                );

            case '指标检索':
                return (
                    <RetrievalSection
                        key={index}
                        data={item}
                        onItemHover={onItemHover}
                        onItemLeave={onItemLeave}
                    />
                );

            case 'error':
                return (
                    <ErrorSection
                        key={index}
                        data={item}
                    />
                );

            default:
                return null;
        }
    });
};

export default StreamDataRenderer;